package cn.dhnep.demo.service.impl;

import cn.dhnep.demo.mapper.PackageOrderItemMapper;
import cn.dhnep.demo.pojo.PackageOrderItem;
import cn.dhnep.demo.pojo.frontvo.PackageOrderItemVo;
import cn.dhnep.demo.service.PackageOrderItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author dhn
 * @since 2021-09-06
 */
@Service
public class PackageOrderItemServiceImpl extends ServiceImpl<PackageOrderItemMapper, PackageOrderItem> implements PackageOrderItemService {

    @Override
    public List<PackageOrderItemVo> horsemanEvenDayPackageOrder() {
        List<PackageOrderItemVo> packageOrderItemVos = baseMapper.horsemanEvenDayPackageOrder();
        packageOrderItemVos.forEach(packageOrderItemVo -> {
                    packageOrderItemVo.setAllCount(baseMapper.getAllCountByHorseName(packageOrderItemVo.getHorseManName()))
                            .setOrderItemVos(baseMapper.getYesterdayPackerOrder(packageOrderItemVo.getHorseManName()));
                }
        );
        return packageOrderItemVos;
    }
}
